<style type="text/css">
.poll ul {
margin: 0 0 5px 0;
padding: 0 0 2px 0;
list-style-type: none;
}	
.poll li{
	padding: 10px 0 0 50px;
}
</style>
<script language="javascript">
$(function(){
	$(".link_vote").click(function(){
		var tbPoll = $(this).closest('.tbPoll');
			$.get("poll/view/" + tbPoll.find("input[name=poll_id]").val(),function(data){
				tbPoll.find('.poll-result').html(data).show();
				//tbPoll.find('.poll').hide();
				});
		return false;
	});
});
</script>

<form method="post" action="poll/vote">
	<div id="content-login" style="padding-left:10px;padding-right:10px;">
		<div align="center">
			<br>
		<table class="tbPoll" align="center" width="350">
			<tr>
				<td><img src="images/poll.png" align="absbottom"><span style="font-size:20px;color:#7DC1E0;">แบบสำรวจความคิดเห็น</span></td>
			</tr>
			<tr>
				<td>
					<h4><?=$poll['title']?></h4>
				</td>
			</tr>
			<tr class="poll">
				<td>
				 <ul>
				 	<?php foreach($polldetails as $polldetail):?>
				 		<li><input type="radio" name="polldetail_id" value="<?=$polldetail['id']?>"><?=$polldetail['name']?></li>
					<?php endforeach;?>				  
				  </ul>
		  		</td>
		 	</tr>
		 	<tr>
		 		<td style="padding-left:50px;">
		 			<input type="submit" name="submit" value="บันทึกผล">
		 			<input class="link_vote" type="button" name="btn_result" value="ดูผลสำรวจ">
		 			<input type="hidden" name="poll_id" value="<?php echo $poll['id'] ?>" />
		 		</td>
		 	</tr>
		 	<tr>
		 		<td><div class="poll-result" style="display:none;"></div></td>
		 	</tr>
		</table>
		</div>
		<br>
	</div>
</form>